package ch3;

public class Company {
    String name;
    String address;
    String telephone;
    String businessScope;
    String[] staff = new String[100];

    public void add(String staffname) {
        for (int i = 0; i < staff.length; i++) {
            if (staff[i] == null) {
                staff[i] = staffname;
                break;
            }
        }
    }

    public void show() {
        System.out.println("员工信息：");
        for (int i = 0; i < staff.length; i++) {
            if (staff[i] == null)
                break;
            System.out.print(staff[i] + " ");
        }
        System.out.println();
    }

    public boolean delete(String oldName) {
        for (int i = 0; i < staff.length; i++) {
            if (oldName.equals(staff[i])) {
                staff[i] = null;
                for (int j = i; j < staff.length - 1; j++) {
                    staff[j] = staff[j + 1];
                    if (staff[j + 1] == null)
                        staff[j] = null;
                }
                staff[staff.length - 1] = null;
            }
        }
        return false;
    }
}


